package com.jxb.myshop.web.servlet;

import com.alibaba.fastjson.JSON;
import com.jxb.myshop.common.ResponseResult;
import com.jxb.myshop.services.GoodsTypeServices;
import com.jxb.myshop.services.impl.GoodsTypeServicesImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/goodsType")
/**
 * @author: JXB
 * @Description:获取货物种类名称
 * @date: 2022/9/18 20:22
 * @param:  * @param null
 * @return: {@link null}
**/
public class GoodsTypeController extends BaseController {
    private GoodsTypeServices gt = new GoodsTypeServicesImpl();

    /**
     * 获取所有货物种类名称
     */
    public String getAll(HttpServletRequest req, HttpServletResponse resp){
        ResponseResult rr = gt.getAll();
        // 用alibaba的json工具包把获取到的数据转为json数据
        String types = JSON.toJSONString(rr);
        return types;
    }

}
